package br.com.gaspar.seam.seguranca.restricao;

import org.jboss.seam.security.Identity;
import org.jboss.seam.security.annotations.Secures;

import br.com.gaspar.seam.seguranca.Admin;

/**
 * Classe que representa as restrições no acesso a métodos
 * @author gaspar
 *
 */
public class Restricao {
	
	@Secures 
	@Admin
	public boolean isAdmin(Identity identity) {
        return identity.hasRole("operador", "USERS", "GROUP");
    }
/*
    public
    @Secures
    @Foo(bar = "abc")
    boolean isFooAbc() {
        return true;
    }

    public
    @Secures
    @Foo(bar = "def")
    boolean isFooDef() {
        return false;
    }

    public
    @Secures
    @User
    boolean isUser(Identity identity) {
        return identity.inGroup("USERS", "GROUP");
    }
    
    public @Secures @Foo(bar = "demo") boolean isDemoUser(Identity identity) {
        return identity.hasPermission("foo", "execute");
    }
    
    public @Secures @Foo(bar = "user") boolean isInUserGroup(Identity identity) {
        return identity.hasPermission("bar", "execute");
    }*/
    
}
